package cn.ggcms.cms.dao.impl;

import java.util.List;

import cn.ggcms.cms.dao.SoftWaresDao;
import cn.ggcms.cms.utils.SimpleDao;
import cn.ggcms.cms.vo.SoftWares;

public class SoftWaresImpl extends SimpleDao<SoftWares> implements SoftWaresDao {

	public boolean doInsertSoftWares(SoftWares SoftWares) {
		boolean flag = false;
		try {
			super.save(SoftWares);
			flag = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public SoftWares findSoftWares(SoftWares SoftWares) {
		return SoftWares;

	}

	public SoftWares finSoftWaresById(int id) {
		return (SoftWares) super.find(SoftWares.class, id);
	}

	public List<SoftWares> finSoftWaress() {

		return super.find(SoftWares.class);
	}

	public boolean doDeleteSoftWaresById(int id) {
		boolean flag = false;
		try {
			super.delete(SoftWares.class, id);
			flag = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return flag;

	}

	public boolean doUpdateSoftWares(SoftWares softWares) {
		boolean flag = false;
		try {
			super.update(softWares);
			flag = true;
		} catch (Exception e) {
			e.printStackTrace();
		}

		return flag;
	}

	public List<SoftWares> findSoftWaresByPage(String hql, int firstResult,
			int maxResults) {
		return super.setFirstResult(firstResult).setMaxResults(maxResults)
				.find(hql);
	}

	public int getSize() {
		return super.getTotalPage(SoftWares.class);

	}

}
